#include "loginwindow.h"
#include <QApplication>
#include"clientSock.h"
#include"recivedata.h"
#include"src/include/ThreadPool.h"
#include"mainwindow.h"
#include<QStringList>
#include<QThread>

int main(int argc, char *argv[])
{
    qDebug()<<"当前线程"<<QThread::currentThreadId();
    //进行注册用于信号之间的传递
    qRegisterMetaType<CloudDrive::MessageReturn>("CloudDrive::MessageReturn");
    qRegisterMetaType<std::shared_ptr<CloudDrive::UploadControl>>("std::shared_ptr<CloudDrive::UploadControl>");
    qRegisterMetaType<CloudDrive::MesBack>("CloudDrive::MesBack");
    qRegisterMetaType<CloudDrive::MesBackFile>("CloudDrive::MesBackFile");
    qRegisterMetaType<CloudDrive::FileInfo>("CloudDrive::FileInfo");
    qRegisterMetaType<CloudDrive::Packet>("CloudDrive::Packet");
    qRegisterMetaType<std::vector<uint8_t>>("std::vector<uint8_t>");

    qRegisterMetaType<std::string>("std::string");

    QApplication a(argc, argv);
    a.setQuitOnLastWindowClosed(true);

    ThreadPool thpool;
    auto task = []{
        ReceiveData::getInstance().reviveData();
    };
    thpool.addFunc(task);
    loginWindow w(nullptr, &thpool);

    Client::getInstance().setThreapool(thpool);

    w.show();

    int result = a.exec();

    return result;
}
